import request from "@/utils/request";

const DEPT_BASE_URL = "/underwriting-companies";

const UnderwritingCompaniesAPI = {
  getInfo(id: string) {
    return request<any, any>({
      url: `${DEPT_BASE_URL}/${id}`,
      method: "get",
    });
  },
  /** 获取组织树形列表 */
  getPage(queryParams?: any) {
    return request<any, any>({ url: `${DEPT_BASE_URL}`, method: "get", params: queryParams });
  },
  /** 获取组织下拉数据源 */
  getOptions() {
    return request<any, OptionType[]>({ url: `${DEPT_BASE_URL}/tree`, method: "get" });
    // return request<any, OptionType[]>({ url: `${DEPT_BASE_URL}/options`, method: "get" });
  },

  /** 获取组织表单数据 */
  getFormData(id: string) {
    return request<any, any>({ url: `${DEPT_BASE_URL}/${id}`, method: "get" });
    // return request<any, any>({ url: `${DEPT_BASE_URL}/${id}/form`, method: "get" });
  },
  /** 新增组织 */
  create(data: any) {
    return request({ url: `${DEPT_BASE_URL}`, method: "post", data });
  },
  /** 修改组织 */
  update(id: string, data: any) {
    return request({ url: `${DEPT_BASE_URL}/${id}`, method: "put", data });
    // return request({ url: `${DEPT_BASE_URL}/${id}`, method: "put", data });
  },
  /** 批量删除组织，多个以英文逗号(,)分割 */
  deleteByIds(ids: string) {
    return request({ url: `${DEPT_BASE_URL}/${ids}`, method: "delete" });
  },
};

export default UnderwritingCompaniesAPI;
